import axios from 'axios'
import NProgress  from 'nprogress'
import 'nprogress/nprogress.css'
const myAxios = axios.create({
    baseURL:'/api',
    timeout:4000,
    
})

myAxios.defaults.withCredentials=true

myAxios.interceptors.request.use(config=>{
    //开启进度条
    NProgress.start()
    return config
})
myAxios.interceptors.response.use(response=>{
    NProgress.done()
    return response.data
},
error=>{
    NProgress.done()
    return new Promise(()=>{})
})
export default myAxios